/**
 * Created by zhuyongjie on 2017/12/12.
 */
$(function () {
    setAjaxLoading();
   if(type == "zip"){
       $("#addDiv").show();
       $("#addSrcDiv").hide();
   } else if(type == "src"){
       $("#addDiv").hide();
       $("#addSrcDiv").show();
   }
});



/**
 * 上传文件
 * @param type
 */
function upload(type) {
    if(type == 2){//资源文件方式上传
        if (!validform("srcForm")) {
            return false;
        }

        $("#srcForm").ajaxSubmit({
            type : "POST",
            url :path + '/deploy/deployments',
            contentType: "multipart/form-data; charset=utf-8",
            // dataType : "json",
            data:{},
            success : function callback(data) {
                var analyMsg = data;
                if (analyMsg.code != '0000') {
                    $.alert('default', 'info', analyMsg.msg);
                } else {
                    $.alert('default','info',"流程部署成功");
                    setTimeout("closeLayer()",100);//设置延时，防止IE下出现异常
                }
            },
            error : function(data, textstatus) {
                $.alert('default', 'error', analyMsg.msg);
            }
        });



    }else if(type == 1){//压缩包形式上传
        if (!validform("zipForm")) {
            return false;
        }
        $("#zipForm").ajaxSubmit({
            type : "POST",
            url :path + '/deploy/deployments',
            contentType: "multipart/form-data; charset=utf-8",
            // dataType : "json",
            data:{},
            success : function callback(data) {
                var analyMsg = data;
                if (analyMsg.code != '0000') {
                    $.alert('default', 'info', analyMsg.msg);
                } else {
                    $.alert('default','info',"流程部署成功");
                    setTimeout("closeLayer()",100);//设置延时，防止IE下出现异常
                }
            },
            error : function(data, textstatus) {
                $.alert('default', 'error', analyMsg.msg);
            }
        });
    }
}